//<debug>
Ext.Loader.setPath({
    'Ext': 'touch/src',
    'FirstMate': 'app'
});
Ext.require('Ext.device.Geolocation');
//</debug>
//var parseOptions = function() {
//    var timeout = this.getTimeout(),
//        ret = {
//            maximumAge: this.getMaximumAge(),
//            // Originally spells *allowHighAccurancy*
//            enableHighAccuracy: this.getAllowHighAccuracy()
//        };
//
//    //Google doesn't like Infinity
//    if (timeout !== Infinity) {
//        ret.timeout = timeout;
//    }
//    return ret;
//};
//Ext.util.Geolocation.override('parseOptions', parseOptions);

Ext.application({
    name: 'FirstMate',

    requires: [
        'Ext.MessageBox'
    ],

    paidVersion : false,
    useCurrentTime : true,
    geo : null,
    date : null,
    position : null,
    defaultPosition : null,
    googleMap : null,
    extMap : null,
    tidesStore : null,
    tideStationsStore : null,
    weatherStore : null,
    weatherCodesStore : null,
    settingsStore :  null,
    tidesMarkers : null,
    tidesInfoWindow : null,
    
    tideUnits : 'ft',
    searchUnits : 'nm',
    searchRadius : 35, //sailor 50 //world 500000
    zoomLevel : 9, // sailor 11 //world 4
    searchCircle : null,
    
    //tidesLayerOn : 1,
    
    NOAAZonesLayer : null,
    NOAAZonesLayerOpacity : 0.1,
    NOAAZonesLayerColor : "FA7DD2",
    NOAAZonesLayerOn : 1,
    
    HRRadarLayer : null,
    HRRadarLayerOpacity : 1,
    HRRadarLayerResolution : '6km',
    HRRadarLayerOn : 1,
    
    fusionTablesAPIKey : "AIzaSyBHbcwY0rNZZwxjIq-ONtrIzyiAPL_yDYM",
    
    KmlLayer : null,
    KmlLayerOpacity : 0.5,
    KmlLayerOn : 1,
    KmlLayerUrl : 'https://maps.google.com/maps/ms?authuser=0&vps=2&hl=en&ie=UTF8&msa=0&output=kml&msid=210170922038761591804.000438ee5192effaa787e', 
    
    weatherLayer : null,
    weatherLayerListener : null,
    weatherLayerOn : 1,
    weatherInfoWindow : null,
    
    bicycleLayer : null,
    bicycleLayerOn : 1,
    cloudLayer : null,
    cloudLayerOn : 1,
    
    views: ['Settings', 'Main','Map','Stations', 'Forecast', 'NWSForecast'],
    controllers: ['Settings','Main','Map', 'MarineWeather'],
    stores: ['Settings','TideStations', 'Tides', 'MarineWeather', 'MarineWeatherCodes'],

    icon: {
        '57': 'resources/icons/Icon.png',
        '72': 'resources/icons/Icon~ipad.png',
        '114': 'resources/icons/Icon@2x.png',
        '144': 'resources/icons/Icon~ipad@2x.png'
    },

    isIconPrecomposed: true,

    startupImage: {
        '320x460': 'resources/startup/320x460.jpg',
        '640x920': 'resources/startup/640x920.png',
        '768x1004': 'resources/startup/768x1004.png',
        '748x1024': 'resources/startup/748x1024.png',
        '1536x2008': 'resources/startup/1536x2008.png',
        '1496x2048': 'resources/startup/1496x2048.png'
    },
           
    onUpdated: function() {
        Ext.Msg.confirm(
            "Application Update",
            "This application has just successfully been updated to the latest version. Reload now?",
            function(buttonId) {
                if (buttonId === 'yes') {
                    window.location.reload();
                }
            }
        );
    }
    

});
